#include "test_modem_info.h"
#include "cm_uart.h"
#include "cm_demo_uart.h"



void cm_test_modem_info_operation(unsigned char*cmd[],int len)
{
    if(0 == strncmp("INFO_RADIO",cmd[2],strlen("INFO_RADIO")))
    {
        cm_radio_info_t *radio_info = (cm_radio_info_t*)cm_malloc(sizeof(cm_radio_info_t));
        int32_t ret = cm_modem_info_radio(radio_info);
        cm_demo_printf("last_cellid:%u, last_earfcn:%u, last_ecl:%u, last_pci:%u, last_snr:%u, rat:%u, rsrp:%u, rsrq:%u, rssi:%u, rx_time:%u, rxlev:%u, tx_power:%u, tx_time:%u\n",radio_info->last_cellid,radio_info->last_earfcn,radio_info->last_ecl,\
        radio_info->last_pci,radio_info->last_snr,radio_info->rat,radio_info->rsrp,radio_info->rsrq,radio_info->rssi,radio_info->rx_time,radio_info->rxlev,radio_info->tx_power,radio_info->tx_time);
        OCTEST_FUNC_EXPECT_EQUAL_INT32(0,ret,cm_modem_get_radio_info);
        cm_free(radio_info);
    }
    else if(0 == strncmp("INFO_CELL",cmd[2],strlen("INFO_CELL")))
    {
        cm_cell_info_t cell_info[3] = {0};
        int32_t ret = cm_modem_info_cell(cell_info, 3);
        cm_demo_printf("cm_modem_get_cell_info ret:%d\n",ret);
        for(int i = 0;i < 3;++i)
        {
             cm_demo_printf("bandwidth:%u, earfcn:%u, earfcn_offset:%u, tac:%u, mcc:%s, mnc:%s, pci:%u, primary_cell:%u, rsrp:%u, rsrq:%u, rssi:%u, snr:%u, cid:%u\n",\
            cell_info[i].bandwidth,cell_info[i].earfcn,cell_info[i].earfcn_offset,cell_info[i].tac,cell_info[i].mcc,cell_info[i].mnc,cell_info[i].pci,cell_info[i].primary_cell,cell_info[i].rsrp,cell_info[i].rsrq,cell_info[i].rssi,cell_info[i].snr,cell_info[i].cid);
        }
        OCTEST_FUNC_EXPECT_GREATER_OR_EQUAL_INT32(0,ret,cm_modem_info_cell);
    }
    else{
        cm_demo_printf("param error!\n");
    }
}